#include"enemymove.h"

vector<enemy> enemymove(vector<enemy> a)
{
	for (vector<enemy>::iterator it = a.begin(); it != a.end(); it++) {
		it->y = it->y + 3;
		int i = (rand() % 10) - 5;

		for (vector<enemy>::iterator oit = a.begin(); oit != a.end(); oit++) {
			if (
				(it->x + i > 0 && it->x + i < 450)
				&&
				(it->x!=oit->x&&it->y != oit->y)
				&&
				!((it->x+i>oit->x&& it->x + i<oit->x+30)&& (it->y>oit->y&& it->y<oit->y+30))
				&&
				!((it->x+50 + i > oit->x && it->x+30 + i < oit->x + 30) && (it->y > oit->y && it->y < oit->y + 30))
				&&
				!((it->x + i > oit->x && it->x + i < oit->x + 30) && (it->y+50 > oit->y && it->y+50 < oit->y + 30))
				&&
				!((it->x+50 + i > oit->x && it->x + 50 + i < oit->x + 30) && (it->y + 50 > oit->y && it->y + 50 < oit->y + 30))
				
				
				)
			{
				it->x = it->x + i;
			}

		}
	}


	return a;


}
